 <?php
 include("include/textcenter.php");
 include("include/db.php");
include("db_config.php");
if(isset($_POST['SubmitAdd']))
{  
    $Product = $_POST['Product'];
    $SKU= $_POST['SKU'];
    $Oem = $_POST['Oem'];
    $Supplier = $_POST['Supplier'];
    $ProductType = $_POST['ProductType'];
    $Price= $_POST['Price'];
    $PriceRetail= $_POST['PriceRetail'];
    $Cost= $_POST['Cost'];
    $Taxable= $_POST['Taxable'];
    $Surcharge= $_POST['Surcharge'];
    $SurchargeTitle= $_POST['SurchargeTitle'];
    $Shipping= $_POST['Shipping'];
    $ShippingExemptInd= $_POST['ShippingExemptInd'];
    $SaleExclude = $_POST['SaleExclude'];
    $Quantity = $_POST['Quantity'];
    $Unit = $_POST['Unit'];
    $Threshold = $_POST['Threshold'];
    $Weight= $_POST['Weight'];
    $Length= $_POST['Length'];
    $Height = $_POST['Height'];
    $Width = $_POST['Width'];
    $ContainerCode = $_POST['ContainerCode'];
    $Brief = $_POST['Brief'];
    $Description = $_POST['Description'];
     
    $Subscription = $_POST['Subscription'];
    
    $Photo = $_POST['Photo'];
    $Thumbnail = $_POST['Thumbnail'];
    $Template = $_POST['Template'];
    $Featured = $_POST['Featured'];
    $Active = $_POST['Active'];
    $AuthReq = $_POST['AuthReq'];
    $Isbn = $_POST['Isbn'];
    $Mpn = $_POST['Mpn'];
    $Upc = $_POST['Upc'];
    $Condition = $_POST['Condition'];
    $Media = $_POST['Media'];
    $NaturalSearchKeywords = $_POST['NaturalSearchKeywords'];
    $NaturalSearchDescription = $_POST['NaturalSearchDescription'];
    $Keywords = $_POST['Keywords'];
    
    $RelateProduct = $_POST['RelateProduct'];
    $ShowPriceYN = $_POST['ShowPriceYN'];
    $AddToCartYN = $_POST['AddToCartYN'];
    $AuthAllowed = $_POST['AuthAllowed'];
    $DiscountYN = $_POST['DiscountYN'];
    $Category = "NULL";
    $category_id = "0";
    $sql = "INSERT INTO `vnf_product` (`Product`, `SKU`, `Oem`, `Supplier`, `ProductType`, `Price`, `PriceRetail`, `Cost`, `Taxable`
    , `Surcharge`, `SurchargeTitle`, `Shipping`, `ShippingExemptInd`, `SaleExclude`
    , `Quantity`, `Unit`, `Threshold`, `Weight`, `Length`, `Height`, `Width`
    , `ContainerCode`, `Brief`, `Description`, `Subscription`, `Thumbnail`
    , `Photo`, `Template`, `Featured`, `Active`, `AuthReq`, `Isbn`
    , `Mpn`, `Upc`, `Condition`, `Media`, `NaturalSearchKeywords`
    , `NaturalSearchDescription`, `Category`, `Keywords`, `category_id`, `RelateProduct`, `ShowPriceYN`, `AddToCartYN`
    , `AuthAllowed`, `DiscountYN`) VALUES('".$Product."', '".$SKU."'
    , '".$Oem."', '".$Supplier."', '".$ProductType."', '".$Price."', '".$PriceRetail."', '".$Cost."', '".$Taxable."'
    , '".$Surcharge."', '".$SurchargeTitle."', '".$Shipping."', '".$ShippingExemptInd."', '".$SaleExclude."'
    , '".$Quantity."', '".$Unit."', '".$Threshold."', '".$Weight."', '".$Length."', '".$Height."', '".$Width."'
    , '".$ContainerCode."', '".$Brief."', '".$Description."', '".$Subscription."', '".$Thumbnail."'
    , '".$Photo."', '".$Template."', '".$Featured."', '".$Active."', '".$AuthReq."', '".$Isbn."'
    , '".$Mpn."', '".$Upc."', '".$Condition."', '".$Media."', '".$NaturalSearchKeywords."'
    , '".$NaturalSearchDescription."', '".$Category."', '".$Keywords."', '".$category_id."'
    , '".$RelateProduct."', '".$ShowPriceYN."', '".$AddToCartYN."'
    , '".$AuthAllowed."', '".$DiscountYN."'
    )";
    mysql_query($sql);
    echo '<meta http-equiv="Refresh" content="0;URL=product_list.php" />';
    /*
		$file = $_FILES["Photo"];
		//$thum = $_FILES["Thumbnail"];
		$file_name = $file["name"];
		//$thum_name = $thum["name"];
		$file_ext = explode(".",$file_name);
	//	$thum_ext = explode(".",$thum_name);
		if($file["name"] == "")
		{	
            $Photo=$file_name;
            $Thumbnail = "";
            $sql = "INSERT INTO `vnf_product` (`Product`, `SKU`, `Oem`, `Supplier`, `ProductType`, `Price`, `PriceRetail`, `Cost`, `Taxable`
    , `Surcharge`, `SurchargeTitle`, `Shipping`, `ShippingExemptInd`, `SaleExclude`
    , `Quantity`, `Unit`, `Threshold`, `Weight`, `Length`, `Height`, `Width`
    , `ContainerCode`, `Brief`, `Description`, `Subscription`, `Thumbnail`
    , `Photo`, `Template`, `Featured`, `Active`, `AuthReq`, `Isbn`
    , `Mpn`, `Upc`, `Condition`, `Media`, `NaturalSearchKeywords`
    , `NaturalSearchDescription`, `Category`, `Keywords`, `category_id`, `RelateProduct`, `ShowPriceYN`, `AddToCartYN`
    , `AuthAllowed`, `DiscountYN`) VALUES('".$Product."', '".$SKU."'
    , '".$Oem."', '".$Supplier."', '".$ProductType."', '".$Price."', '".$PriceRetail."', '".$Cost."', '".$Taxable."'
    , '".$Surcharge."', '".$SurchargeTitle."', '".$Shipping."', '".$ShippingExemptInd."', '".$SaleExclude."'
    , '".$Quantity."', '".$Unit."', '".$Threshold."', '".$Weight."', '".$Length."', '".$Height."', '".$Width."'
    , '".$ContainerCode."', '".$Brief."', '".$Description."', '".$Subscription."', '".$Thumbnail."'
    , '".$Photo."', '".$Template."', '".$Featured."', '".$Active."', '".$AuthReq."', '".$Isbn."'
    , '".$Mpn."', '".$Upc."', '".$Condition."', '".$Media."', '".$NaturalSearchKeywords."'
    , '".$NaturalSearchDescription."', '".$Category."', '".$Keywords."', '".$category_id."'
    , '".$RelateProduct."', '".$ShowPriceYN."', '".$AddToCartYN."'
    , '".$AuthAllowed."', '".$DiscountYN."'
    )";
    mysql_query($sql);
        }
        else if(($file["name"] != "")&&($file_ext[count($file_ext)-1] == "jpg" || $file_ext[count($file_ext)-1] == "jpeg" || $file_ext[count($file_ext)-1] == "gif" || $file_ext[count($file_ext)-1] == "png"))
		{
            $Photo=$file_name;
            //echo $Photo;
        	$sql = "INSERT INTO `vnf_product` (`Product`, `SKU`, `Oem`, `Supplier`, `ProductType`, `Price`, `PriceRetail`, `Cost`, `Taxable`
    , `Surcharge`, `SurchargeTitle`, `Shipping`, `ShippingExemptInd`, `SaleExclude`
    , `Quantity`, `Unit`, `Threshold`, `Weight`, `Length`, `Height`, `Width`
    , `ContainerCode`, `Brief`, `Description`, `Subscription`, `Thumbnail`
    , `Photo`, `Template`, `Featured`, `Active`, `AuthReq`, `Isbn`
    , `Mpn`, `Upc`, `Condition`, `Media`, `NaturalSearchKeywords`
    , `NaturalSearchDescription`, `Category`, `Keywords`, `category_id`, `RelateProduct`, `ShowPriceYN`, `AddToCartYN`
    , `AuthAllowed`, `DiscountYN`) VALUES('".$Product."', '".$SKU."'
    , '".$Oem."', '".$Supplier."', '".$ProductType."', '".$Price."', '".$PriceRetail."', '".$Cost."', '".$Taxable."'
    , '".$Surcharge."', '".$SurchargeTitle."', '".$Shipping."', '".$ShippingExemptInd."', '".$SaleExclude."'
    , '".$Quantity."', '".$Unit."', '".$Threshold."', '".$Weight."', '".$Length."', '".$Height."', '".$Width."'
    , '".$ContainerCode."', '".$Brief."', '".$Description."', '".$Subscription."', '".$Thumbnail."'
    , '".$Photo."', '".$Template."', '".$Featured."', '".$Active."', '".$AuthReq."', '".$Isbn."'
    , '".$Mpn."', '".$Upc."', '".$Condition."', '".$Media."', '".$NaturalSearchKeywords."'
    , '".$NaturalSearchDescription."', '".$Category."', '".$Keywords."', '".$category_id."'
    , '".$RelateProduct."', '".$ShowPriceYN."', '".$AddToCartYN."'
    , '".$AuthAllowed."', '".$DiscountYN."'
    )";
    mysql_query($sql);
   
            move_uploaded_file($_FILES["Photo"]["tmp_name"],UPLOAD_PATH.$_FILES["Photo"]["name"]);
            echo UPLOAD_PATH.$_FILES["Photo"]["name"];	
        	//echo '<meta http-equiv="Refresh" content="0;URL=product_list.php" />';
        	return;
		}
        else if(($file["name"] != "")&&($file_ext[count($file_ext)-1] != "jpg" || $file_ext[count($file_ext)-1] != "jpeg" || $file_ext[count($file_ext)-1] != "gif" || $file_ext[count($file_ext)-1] != "png"))
		{
			$alert='<script type="text/javascript">
			alert("Please choose file type jpg, jpeg, gif");
			</script>';
			echo $alert;
		}*/
}
mysql_close($con);

 ?>
 <p></p>
<html>
<head>
<meta name="description" content="Admin<?php echo $tagdescription?>">
<meta name="keywords" content="<?php echo $tagkeywords?> Main">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><?php echo $tagtitle?></title>
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript" src="simpletreemenu.js">
/***********************************************
* Simple Tree Menu- Â© Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<link rel="stylesheet" type="text/css" href="simpletree.css" />
<link rel="StyleSheet" href="include/css_classes.css" type="text/css" />
<script type="text/javascript"> 
    $(document).ready(function() {
        $('.getfile').click(function() {
            window.KCFinder = {}; 
            var id = $(this).attr('rel');
            window.KCFinder.callBack = function(url) {
                window.KCFinder = null;
                // Actions with url parameter here
                var value = url.replace('', '');
                $('#' + id).val(value);
                if (value) {
                    $('#show' + id).html('<img src="' + value + '" style="max-width:200px">')
                }
            };
            kfm_url = 'kcfinder/browse.php';
            //window.open(kfm_url, 'kcfinder_single');
            window.open(kfm_url,"kfm","modal,width=960,height=640");
        });
        
        $('.imageinput').change(function() {
            var id = $(this).attr('id');
            if ($(this).val()) {
                $('#show' + id).html('<img src="' + $(this).val() + '" style="max-width:200px">')
            }
        });
    });
</script> 
</head>



<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" link="#0000FF" vlink="#800080" alink="#FF0000" bgcolor="#FFFFFF">
<!-- -------------------Header---------------------------- -->
<?php include("include/header.php"); ?>
<!-- -------------------End Header---------------------------- -->


<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="12%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="200" height="1"></td>
		<td width="1%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="16" height="1"></td>
		<td width="86%" valign="top">
		<img border="0" src="public/images/homepage/spider16.gif" width="16" height="1"></td>
	</tr>	
	<tr>
		<!-- ///////////////////Begin Leftmenu/////////////////// -->
		<td width="12%" valign="top" bgcolor="#FFFFFF">
		<?php include("include/leftmenu.php"); ?>
		</td>
		<!-- ///////////////////End Leftmenu/////////////////// -->
		
		<td width="1%" valign="top" background="public/images/homepage/16.gif">&nbsp;</td>
		<td width="86%" valign="top">
	<br>
<!-- -------------------Begin Body---------------------------- -->
<p class="title16B">&nbsp;Add New Product</p>

<form action="" method="post" name="appForm" id="appForm" enctype="multipart/form-data">
	<table align="left" border="1" width="50%" cellspacing="0" bordercolor="#FFF4FF" bgcolor="#FFFFFF">
        <tr>
            <td>
                 <i style="font-size: 15px;">Please fill in these fields (<font style="color: red;">*</font>)</i>
            </td>
        </tr>
		<tr>
			<td>
				<table>
					<tr>
                 
						<td valign="top" width="180" align="right">Product Name</td>
						<td valign="top" width="120">
			            	<input type="text" name="Product" id="Product" /><font style="color: red;"> *</font>
			            </td>
					</tr>
			        <tr>
						<td valign="top" width="180" align="right">SKU</td>
						<td valign="top" width="120">
			            <input type="text" name="SKU" id="SKU"/><font style="color: red;"> *</font>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Oem</td>
						<td valign="top" width="120">
			            	<input type="text" name="Oem" id="Oem" />
			            </td>
					</tr>
			        <tr>
						<td valign="top" width="180" align="right">Price</td>
						<td valign="top" width="120">
			            <input type="text" name="Price" id="Price" /><font style="color: red;"> *</font>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Price Retail</td>
						<td valign="top" width="120">
			            <input type="text" name="PriceRetail" id="PriceRetail" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Cost</td>
						<td valign="top" width="120">
			            <input type="text" name="Cost" id="Cost" />
			            </td>
					</tr>
			        <tr>
						<td valign="top" width="180" align="right">Shipping</td>
						<td valign="top" width="120">
			            <input type="text" name="Shipping" id="Shipping"/>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Shipping ExemptInd</td>
						<td valign="top" width="120">
			            <input type="text" name="ShippingExemptInd" id="ShippingExemptInd"/>
			            </td>
					</tr>
			         <tr>
						<td valign="top" width="180" align="right">Quantity</td>
						<td valign="top" width="120">
			            <input type="text" name="Quantity" id="Quantity"/><font style="color: red;"> *</font>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Unit</td>
						<td valign="top" width="120">
			            <input type="text" name="Unit" id="Unit"/>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Featured</td>
						<td valign="top" width="120">
			            <input type="text" name="Featured" id="Featured"/>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">SaleExclude</td>
						<td valign="top" width="120">
			            <input type="text" name="SaleExclude" id="SaleExclude"/>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Threshold</td>
						<td valign="top" width="120">
			            <input type="text" name="Threshold" id="Threshold"/>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Photo</td>
						<td valign="top" width="120">
						<!--<input type="file" name="Photo" id="Photo"/>-->
			            <!-- <input type="text" name="Photo" id="Photo"/>-->
                        <input type="text" name="Photo" id="Photo" class="input imageinput" /> 
                        <input type="button" id="getfile" value="Choose file" rel="Photo" class="getfile" /> 
                        <div id="showPhoto"></div> 
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Thumbnail</td>
						<td valign="top" width="120">
			            <input type="text" name="Thumbnail" id="Thumbnail" class="input imageinput" />
                         <input type="button" id="getThumbnail" value="Choose file" rel="Thumbnail" class="getfile" /> 
                        <div id="showThumbnail"></div> 
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Template</td>
						<td valign="top" width="120">
			            <input type="text" name="Template" id="Template"/>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Isbn</td>
						<td valign="top" width="120">
			            	<input type="text" name="Isbn" id="Isbn" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Mpn</td>
						<td valign="top" width="120">
			            	<input type="text" name="Mpn" id="Mpn" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Upc</td>
						<td valign="top" width="120">
			            	<input type="text" name="Upc" id="Upc" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Condition</td>
						<td valign="top" width="120">
			            	<input type="text" name="Condition" id="Condition" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Media</td>
						<td valign="top" width="120">
			            	<input type="text" name="Media" id="Media" />
			            </td>
					</tr>
					<tr>	
						<td valign="top" width="180" align="right">Supplier</td>
						<td valign="top" width="120">
			            	<input type="text" name="Supplier" id="Supplier" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">ProductType</td>
						<td valign="top" width="120">
			            	<input type="text" name="ProductType" id="ProductType" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Taxable</td>
						<td valign="top" width="120">
			            	<input type="text" name="Taxable" id="Taxable" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Surcharge</td>
						<td valign="top" width="120">
			            	<input type="text" name="Surcharge" id="Surcharge" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">SurchargeTitle</td>
						<td valign="top" width="120">
			            	<input type="text" name="SurchargeTitle" id="SurchargeTitle" />
			            </td>
					</tr>
				</table>
			</td>
			<td>
				<table>
					<tr>
						<td valign="top" width="180" align="right">Weight</td>
						<td valign="top" width="120">
			            	<input type="text" name="Weight" id="Weight" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Length</td>
						<td valign="top" width="120">
			            	<input type="text" name="Length" id="Length" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Height</td>
						<td valign="top" width="120">
			            	<input type="text" name="Height" id="Height" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Width</td>
						<td valign="top" width="120">
			            	<input type="text" name="Width" id="Width" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">ContainerCode</td>
						<td valign="top" width="120">
			            	<input type="text" name="ContainerCode" id="ContainerCode" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Brief</td>
						<td valign="top" width="120">
			            	<input type="text" name="Brief" id="Brief" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Description</td>
						<td valign="top" width="120">
			            	<textarea rows="17" cols="30" name="Description" id="Description"></textarea>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Subscription</td>
						<td valign="top" width="120">
			            	<input type="text" name="Subscription" id="Subscription" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">RelateProduct</td>
						<td valign="top" width="120">
			            	<input type="text" name="RelateProduct" id="RelateProduct" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">NaturalSearchDescription</td>
						<td valign="top" width="120">
			            	<input type="text" name="NaturalSearchDescription" id="NaturalSearchDescription" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">NaturalSearchKeywords</td>
						<td valign="top" width="120">
			            	<input type="text" name="NaturalSearchKeywords" id="NaturalSearchKeywords" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Keywords</td>
						<td valign="top" width="120">
			            	<input type="text" name="Keywords" id="Keywords" />
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">Active</td>
						<td valign="top" width="120">
			            	<select name="Active">
			            		<option value="Yes">Yes</option>
			            		<option value="No">No</option>
			            	</select>
			            </td>
					</tr>
					 <tr>
						<td valign="top" width="180" align="right">AuthReq</td>
						<td valign="top" width="120">
			            	<select name="AuthReq">
			            		<option value="Yes">Yes</option>
			            		<option value="No">No</option>
			            	</select>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">ShowPriceYN</td>
						<td valign="top" width="120">
			            	<select name="ShowPriceYN">
			            		<option value="Yes">Yes</option>
			            		<option value="No">No</option>
			            	</select>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">AddToCartYN</td>
						<td valign="top" width="120">
			            	<select name="AddToCartYN">
			            		<option value="Yes">Yes</option>
			            		<option value="No">No</option>
			            	</select>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">AuthAllowed</td>
						<td valign="top" width="120">
			            	<select name="AuthAllowed">
			            		<option value="Yes">Yes</option>
			            		<option value="No">No</option>
			            	</select>
			            </td>
					</tr>
					<tr>
						<td valign="top" width="180" align="right">DiscountYN</td>
						<td valign="top" width="120">
			            	<select name="DiscountYN">
			            		<option value="Yes">Yes</option>
			            		<option value="No">No</option>
			            	</select>
			            </td>
					</tr>
					
					
				</table>
			</td>
		</tr>	
		<tr>
			<td valign="top" width="180">&nbsp;<input type="submit" value="Add New Product" name="SubmitAdd" /></td>
			<td valign="top" width="620">
			</td>
		</tr>
		
	</table>
   

	<p><br>
&nbsp;</p>
</form>

		<p>&nbsp;</p>


<!-- -------------------End Body---------------------------- -->

&nbsp;</td>
	</tr>

</table>
</div>
<!-- ----------------------------------------------- -->
<!-- \\\\\\\\\\\\\\\\\\\\\Begin Footer\\\\\\\\\\\\\\\\\\\\\ -->
<?php include("include/footer.php"); ?>
<!-- \\\\\\\\\\\\\\\\\\\\\End Footer\\\\\\\\\\\\\\\\\\\\\ -->
</body>

</html>